<html>
<head>
	<meta charset="UTF-8">
	<title>axios-请求头设置</title>
	<script type="text/javascript" src="./axios.js"></script>
</head>
<body>

<script type="text/javascript">
//get,post请求都有
axios.defaults.headers['headtest0'] = 'headtestval00';
//仅限get
axios.defaults.headers.get['headtest1'] = 'headtestval11';
//仅限post
axios.defaults.headers.post['headtest2'] = 'headtestval22';
//设置单个请求头-1
axios({
	headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
    },
    method: 'get',
    url: '/user/test1',
    data: {
    	'param1': 'value1',
    	'param2': 'value2',
    }
});
//设置单个请求头-2
axios.post('/user/test2', {
	'param1': 'value1',
	'param2': 'value2',
}, {
	headers: {
		'Content-Type': 'multipart/form-data'
	}
});
</script>
</body>
</html>